package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.CollectionRequest;
import one.stand.request.CompanyRecruitRequest;
import one.stand.request.CompanyRequest;
import one.stand.request.RoyaltyRecordRequest;
import one.stand.response.CompanyRecruitResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 个人中心
 *
 * @author Administrator
 */
@RestController
@RequestMapping("/personal")
public class PersonalController extends BaseController {

    /**
     * 添加收藏
     */
    @PostMapping("/addCollection")
    public ResultModel addCollection(@RequestBody CollectionRequest request) {
        return personalService.addCollection(request.getId().intValue(), request.getItemType(), request.getItemId());
    }

    /**
     * 取消收藏
     */
    @PostMapping("/delCollection")
    public ResultModel delCollection(@RequestBody CollectionRequest request) {
        return personalService.delCollection(request.getId().intValue(), request.getItemType(), request.getItemId());
    }

    /**
     * 查询收藏
     */
    @PostMapping("/getCollection")
    public ResultModel getCollection(@RequestBody CollectionRequest request) {
        return personalService.getCollection(request);
    }

    /**
     * 查询公司信息
     */
    @PostMapping("/getCompanyAllInfo")
    public ResultModel getCompanyAllInfo(@RequestBody CompanyRequest request) {
        return personalService.getCompanyAllInfo(request);
    }

    /**
     * 查询公司招聘信息
     */
    @PostMapping("/getCompanyRecruit")
    public ResultModel<List<CompanyRecruitResponse>> getCompanyRecruit(@RequestBody CompanyRecruitRequest request) {
        return personalService.getCompanyRecruit(request);
    }

    /**
     * 佣金/提现列表
     */
    @PostMapping("/selectRoyaltyRecord")
    public ResultModel<Map<String, Object>> selectRoyaltyRecord(@RequestBody RoyaltyRecordRequest request) {
        return userService.selectRoyaltyRecord(request);
    }

    /**
     * 提现操作
     */
    @PostMapping("/doCash")
    public ResultModel<Boolean> doCash(@RequestBody RoyaltyRecordRequest request) {
        return userService.doCash(request);
    }
}
